-- @owner: @zou_jialiang050
-- @date: 2022/09/15
-- @testpoint: show create trigger查询触发条件为instead of触发器

--step1:建表及触发器;expect:成功
drop table if exists t_show_create_trigger_0009 cascade;
create table t_show_create_trigger_0009(id1 int, id2 int, id3 int);
create or replace view v_show_create_trigger_0009 as select * from t_show_create_trigger_0009;
create or replace function f_show_create_trigger_0009()
returns trigger as $$
begin
insert into t_show_create_trigger_0009 values(5,6,7);
return new;
end;
$$language plpgsql;
/

drop trigger if exists tri_show_create_trigger_0009 on t_show_create_trigger_0009;
create trigger tri_show_create_trigger_0009
instead of insert on v_show_create_trigger_0009
for each row
execute procedure f_show_create_trigger_0009();
/

--step2:show create trigger查询触发条件为instead of触发器;expect:成功
show create trigger tri_show_create_trigger_0009;

--step3:清理环境;expect:成功
drop trigger if exists tri_show_create_trigger_0009 on t_show_create_trigger_0009;
drop view if exists v_show_create_trigger_0009;
drop table if exists t_show_create_trigger_0009 cascade;
drop function if exists f_show_create_trigger_0009;
